Skip to content

feat(libkernel): support deferred cancellation in POSIX accept - #12965

Draft
Felipebmaitan wants to merge 193 commits into
boykopovar:mainfrom
Felipebmaitan:feat/posix-connection-cancellation
Draft

Felipebmaitan wants to merge 193 commits into
boykopovar:mainfrom
Felipebmaitan:feat/posix-connection-cancellation

Conversation

@Felipebmaitan

@Felipebmaitan Felipebmaitan commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What

Head 82eaaf776697625bd9e186d94f7e87c6301f4c30, integrated main d23df92b3805fea21493a73cbed8835c9e8548d0 through ordinary merge history, preserving every previously published head and maintainer commit.

Implement cancellable accept above writes, retaining unpublished accepted descriptors through deferred delivery and disposing them before cleanup/TSD after cancellation or context abandonment. Keep EMFILE pre-reservation and ENOMEM pre-map installation-failure injection, peer EOF/reuse and handoff-onward resource checks. Those snapshots do not exclude earlier setup leaks. Inherit the requested transport assertion removal; production gap/debt and implemented socket coverage remain. Accept stays draft while the intermittent Windows 22621 sigjump hang remains unresolved.

#12149 merged November 4 at 05:34 UTC and #9019 merged November 4 at 17:34 UTC; both are satisfied in main. #10552/#10817/#10755 are also merged. All four Apple empty-iovec guards, general context restoration, synchronous writes and deterministic stream-close hooks/comparisons remain. No archive #11625 work or unrelated owner branch was changed.

8-file incremental comparison against the actual lower-layer ancestor. The main-based Files view remains cumulative until the still-open stack layers merge.

Consolidated maintainer response and evidence.

Tested

Current accept progress audit: the live report now compares main d23df92 with accept 82eaaf7. Reproduced libkernel counts: main 703 done / 55 todo, this head 696 / 62. A temporary scanner-only copy replacing only Transfer's blocking-stream receive PEEK|WAITALL NotImplemented marker with a generic throw restores 703 / 55 and precisely accept/recv/recvfrom/recvmsg/send/sendfile/sendto. The helper-name propagation does not evaluate platform, send/receive or flag guards. Accept passes no PEEK|WAITALL flags and send paths cannot enter the receive-only guard; receive paths retain the documented unsupported Windows combination alongside implemented behavior. This is classification evidence only, not runtime qualification or proof that every input is implemented. The production gap marker/debt and scanner stay intact, and the maintainer-requested removal of tests requiring the missing feature remains. No unconditional seven-function stub replacement or new source fix follows from this report. Current Windows execution evidence and the unresolved Windows 22621/macOS limits remain recorded below; accept stays draft.

Accept overlap audit at 82eaaf7: the bot snapshot updated 2026-11-05 12:56:30 UTC has zero compared rows and 304 uncomparable branches. The checker marks shared files uncomparable if either side lacks a merged tree. Reproduced that prior accept 6db9957 conflicts with main d23df92 in libkernel debt, whereas current accept merges cleanly. An older-head snapshot is consistent with the report, but its exact captured accept SHA is not proven; the table does not establish 304 new branch conflicts.

Fresh local branch-mode scan of this exact accept head against the same main covers 1,832 PRs and returns 28 compared / 84 uncomparable. It includes already-declared #12682/#12688 prerequisites; those are not new independent dependencies. The previous selected patches remain applicable. Updated #13582 552610f and #13587 6eff7b6 retain identical selected production/test source blobs to the audited prior heads; no whole-branch or joint-runtime clearance. #7485 5052a3f, #10645 b1d851b and #12170 db8c8ef remain unchanged; preserve their missing-length error precedence, low-water/readiness behavior and checked signal-mask ordering alongside cancellation/retained-result lifetime.

New selected #15890 69470e7 forwards ioctl on sceNetSocket descriptors through a retained native owner and registered libSceNet callback. Its header/registration, malformed-request/null-argument ordering and ownership must stay together when later composed, alongside this stack's descriptor generations and deferrals. It supplies no helper accept currently calls. The existing-main sendto notice remains the previously checked single-definition/single-declaration export, with no duplicate registration to remove. Archive #11625 remains separately owned and untouched; its appearance in the branch-mode scan is composition evidence only, with no import or joint test claimed. All 84 uncomparable branches remain uncleared. Depends on stays #12682, #12688, #12700; #12149/#9019 are satisfied. No repeated overlap comment or source push follows from this audit.

Current-head Windows verification: native Windows job succeeds at 82eaaf776697625bd9e186d94f7e87c6301f4c30. The earlier manual dispatch HTTP 403 remains historical; dispatch is no longer a blocker for this head's Windows execution. Read the job log: main d23df92 merged with this head; 2,897 passed / 1,033 skipped / zero failed, 3,930 scheduled, 191.07 s. All 15 accept cases pass, including both installation failures and cancellation/jump handoff disposal. guest_socket_dontwait passes 5.85 s, guest_socket_transfer_progress 2.06 s and guest_udp 1.73 s. Resource measurements retain their handoff-onward setup-leak limit. One sigjump sample passes 0.02 s, which does not resolve Windows 22621. Other checks remain incomplete with no observed current failures. Reads/transport/writes approvals remain pinned to earlier parent heads; no new review is inferred. The old accept macOS x86-64 timeout remains unexplained, and accept stays draft for the unresolved Windows 22621 hang.

Main-integration follow-up: authoritative head 82eaaf776697625bd9e186d94f7e87c6301f4c30, main d23df92b3805fea21493a73cbed8835c9e8548d0. During the reads overlap audit the bot refreshed to 12 compared / 81 uncomparable branches at 2026-11-05 12:56:19 UTC. #15698 is confirmed merged; its removed row is satisfied by main. The other removed rows are not treated as merged or cleared merely because they disappeared. The remaining compared heads match the selected-source audits; no new implementation dependency. The existing-main recvfrom notice was checked: one implementation definition and one canonical declaration in main and reads, with no duplicate registration to remove.

The pre-push fetch caught maintainer commits a564d53 (reads), 95ce593 (transport) and 6076fc5 (writes). Those published commits were adopted unchanged; only accept needed a new ordinary merge of the maintainer's writes head, producing 82eaaf7. Main's macOS process-start-block pages stay mapped, and the debt still states that POSIX read/receive waits wake and defer delivery until ownership guards are released. No maintainer source resolution was overwritten.

All four authoritative heads pass required conventions and whitespace checks (the existing SSL warning remains on the upper layers). The changed MainThreadMacOs.cpp passes host macOS x86-64 syntax checking. Linux I/O production sources and the selected I/O fixtures are unchanged from the earlier composed 93-test run; guest_socket_dontwait passes again against those unchanged Linux binaries (1.93 s; 2.07 s CTest total). This is not execution of the macOS stack-move fixture or a fresh full-suite run. The refreshed coordinated overlap scan covers 1,831 PRs and fails closed for 84 uncomparable branches at the top accept tree; the reads report's 81 count has different scope and remains uncleared. No repeated no-change overlap comment is posted. New integration-head checks/reviews remain pending; earlier runtime results and approvals below are historical at the heads they name. The earlier manual dispatch was denied HTTP 403; current Windows jobs are recorded above, so dispatch is no longer a blocker for these heads; the intermittent Windows 22621 hang and old accept macOS x86-64 timeout remain unresolved. Accept stays draft.

Composed accept tree 6db995790dbe9193ee44028e327ad907faaa5cba with main e772fb25cc72ee5faf77847f06bbc69533016e82: Ubuntu 24.04.5/GCC 13.3 Release, x86-64 Docker through Apple Silicon translation. Rebuilt libc/libkernel/libSceLibcInternal/libkernel_sys and focused fixtures. 30/30 selected socket/UDP/context/accept tests pass (4.60 s): guest_socket_dontwait 1.78 s, guest_udp 1.59 s, all 15 accept cases including both installation failures and cancel/jump handoff disposal. 63/63 selected synchronous-write/stream-close tests pass (3.13 s). These are composed-stack focused results, not a full suite or independent runtime runs of every layer. Both requested test removals are present; implemented nonblocking/peek and delayed partial-buffer cases remain.

Required python3 tools/check_conventions.py --base origin/main checks pass for all four final heads, using an isolated Git context whose origin/main is the actual fetched upstream main above. Reads has no findings; upper layers retain only the existing SSL debt-length warning. Whitespace, preserved-parent and bottom-up ancestor checks pass. The coordinated stack overlap scan covers 1,811 open PRs and fails closed for 100 uncomparable branches; no whole-branch overlap clearance or owner-order agreement is claimed. Latest main and all four remote heads were fetched before the atomic fast-forward-only push. GitHub reports all four branches merge cleanly.

Earlier Windows verification status, superseded by the current results above: After the earlier publication, ordered Build dispatch 12682 12688 12700 12965 was rejected with HTTP 403, “Must have admin rights to Repository.” At that point a collaborator/admin dispatch was requested for guest_socket_dontwait plus native Windows guest_socket_transfer_progress; current runs above now supply execution. The available MinGW 13 cross-syntax attempt stops at newer main's _fflush_nolock declaration; no native Windows execution is inferred. The previous published heads' Windows jobs passed, but do not qualify these updates. New-head CI/review requires refresh.

Prior XairRrR approvals are historical: reads 32169af, transport 70120f1, writes fbd44d3. Accept's prior review is COMMENTED and it remains draft. No new approval is inferred.

The old accept macOS x86-64 job126136729127 remains failed at attempt 1; refreshed status/log reads 668 passed and guest_none_relocations timed out at 20.12 s, 354.88 s total. Its cause and a fix are unestablished; there is no fresh full macOS runtime qualification. The intermittent Windows 22621 sigjump hang remains unresolved; these Linux passes do not resolve it. Retained SSL waits, per-call I/O overhead and the cancelling-caller indefinite spin retain their debt/limits. Unpublished signal-registry/cancellation-request and SyncWrites-exception candidates are excluded. No new title/console, GPU or paired same-scene trace_digest run; no performance claim. Maintainer title-scene bench remains external.

Checklist

lgqdaxia and others added 30 commits October 25, 2026 22:47
Keep native signals arriving beyond the receive timeout and bound the retained-owner wait. The same fixture rejects a source variant that incorrectly restarts its deadline after EINTR.

AI-assisted: Codex
Read O_NONBLOCK from the native socket for every retained transfer so descriptor aliases and passed sockets do not turn nonblocking I/O into a blocking wait. Keep guest timeout accounting and native query errors intact.

AI-assisted: Codex
Exercise real native descriptor aliases switching both blocking directions and a saturated nonblocking send after the guest descriptor closes, independently of SCM_RIGHTS.

AI-assisted: Codex
@Felipebmaitan

Copy link
Copy Markdown
Contributor Author

Propagated the transport review fixes into 858e850, preserving the previous published head as an ancestor. Partial-buffer recvfrom probes now share the receive retry/deadline; Windows blocking stream MSG_PEEK|MSG_WAITALL throws rather than synthesizing EOPNOTSUPP. Unix retained SSL cancellation/close wait limits are explicitly documented, not resolved. Existing write/accept hooks, progress and disposal behavior remain.

Final composed runtime/test sources pass 660/660 focused Linux CTests (67.96 s), following transport 9/9 and libSceNet 11/11 passes. Windows cross-target syntax checks pass; no new native Windows execution is claimed. Conventions pass with only the inherited SSL debt-length warning; whitespace and read-only composition with main 1e65852 pass. Fresh overlap scanning still fails closed for uncomparable branches. Latest remote heads were fetched before atomic fast-forward-only publication, and the full template records exact heads/evidence/limits. Previous-head CI passes/failures do not qualify these heads.

Fresh native Windows/ordered validation is pending: dispatch for 9019 12149 12682 12688 12700 12965 was denied HTTP 403/admin rights. The independent Windows 22621 intermittent sigjump hang remains unresolved; accept stays draft. No performance claim, replacement PR or merge. Incremental comparison and prerequisite order are retained.

@Felipebmaitan

Copy link
Copy Markdown
Contributor Author

Audited the progress report at accept 858e850, against main 1e65852.

The same helper-name classification effect as transport and writes reproduces on this exact head. A temporary scanner-only control changing only Transfer’s NotImplemented marker to a generic throw restores precisely accept/recv/recvfrom/recvmsg/send/sendfile/sendto to done labels. The scanner does not evaluate the Windows + blocking-stream + receive + PEEK|WAITALL guard. Send paths cannot take it; accept passes no peek/waitall flags. The receive exports retain that documented unsupported combination alongside their normal implementations. No unconditional seven-function stub replacement occurred.

The required unsupported-path marker and scanner are unchanged. The +1 libkernel_sys pwrite comes from the declared writes/#9019 prerequisite; accept does not reimplement it. This control is classification evidence, not runtime qualification or proof of unsupported-mode support.

Updated the full template. No source fix or push is warranted by this report. Current-head checks have 18 successful / 2 running / 1 skipped / 1 cancelled and no failure, so are not complete. The PR remains draft, local review-fix candidates remain unpublished pending runtime verification, and the Windows 22621 sigjump hang remains unresolved.

@Felipebmaitan

Copy link
Copy Markdown
Contributor Author

Propagated the transport Windows-test expectation repair into 27a82bc. The parent transport Windows run recorded 2,389 passed / 981 skipped / 1 failed: new delayed partial-buffer guest_udp and guest_socket_transfer_progress fixtures passed, while the older guest_socket_dontwait still expected EOPNOTSUPP instead of the required unsupported throw.

This update changes only that assertion and the two debt files. It retains throw/counter, untouched-buffer, queued-byte and nonblocking checks; production/runtime libraries are unchanged. Syntax and isolated contract/control checks pass, as do required conventions (inherited SSL warning only), whitespace and read-only main composition. Overlap scanning remains fail-closed. Latest heads were fetched before atomic fast-forward-only publication; full templates retain exact heads and incremental comparisons.

Fresh native CI of this corrected fixture remains pending; parent-head evidence is not an all-green or new-head result. The broader unverified local signal/cancellation and SyncWrites-exception changes were excluded from this push and remain unpublished. Accept remains draft; Windows 22621 sigjump remains unresolved. No merge or performance claim.

@Felipebmaitan

Copy link
Copy Markdown
Contributor Author

Audited the 2026-11-03 18:45:03 UTC overlap refresh at 27a82bc: 20 compared / 88 uncomparable branches. All 20 compared heads match the existing selected-source audits.

The newly listed #13468 ed4c0e1, #13582 6d05fb4, #13587 b9727f2, #15508 c87d4dc and #15524 887c319 have the same selected patches already read for transport. The affected Thread.cpp, SignalSets.cpp, ModuleInfo.cpp, AddressConversion.cpp and SSL Export.cpp files are identical between published transport and accept. Preserve their independent checked-copy ordering/test/debt coverage alongside I/O cancellation and context behavior when later composed. Neither new helper dependency nor import is warranted; no joint runtime pass or order agreement is implied.

#14085 returned with its unchanged already-audited head. #10749 remains open; its removed uncomparable row is not an upstream merge. Depends on remains #12149, #12682, #12688, #9019, #12700. This review does not clear 88 uncomparable branches.

Updated the full template. No source change or push warranted by this report. The branch remains draft and mergeable, checks are queued, and fresh Windows validation of the corrected fixture is pending. Windows 22621 sigjump remains unresolved.

@Felipebmaitan

Copy link
Copy Markdown
Contributor Author

Rechecked the refreshed progress report at 27a82bc. Its entries/counts match the previous audit. Repeated the temporary scanner-only control at this exact head: replacing only Transfer’s required unsupported Windows receive marker with a generic throw restores precisely the same seven done labels.

This remains conservative helper-name classification without platform/flag guard evaluation, not unconditional replacement of seven exports with stubs. The +1 libkernel_sys pwrite is inherited from the declared writes/#9019 prerequisite. The production marker and scanner rules are unchanged; no runtime qualification is implied by the control.

Refreshed the existing full-template audit paragraph. No source change or push warranted. Current checks have no failures but are incomplete; accept remains draft and Windows 22621 sigjump remains unresolved.

@Felipebmaitan

Copy link
Copy Markdown
Contributor Author

Investigated the current-head macOS x86-64 failure at 27a82bc, composed onto main 1e65852.

Configure/build succeeds; 668 pass / one guest_none_relocations timeout, 669 scheduled, 354.88 s. That fixture reaches its explicit 20 s limit at 20.12 s, the same test as the older reported macOS failures. Inspected root CMake/core/relinker/tools/nid/register-context inputs match that main baseline. A fresh local macOS/Rosetta x86-64 Release diagnostic repeats four relocation neighbors three times with parallelism four: 12/12 executions pass, 7.30 s total; the timed-out fixture takes 2.79/2.30/2.21 s here. This does not explain the CI timeout or clear its failed check. The log names no active conversion case. No arbitrary timeout bump, removed coverage or source workaround.

Requested the exact failed job again; GitHub rejected /actions/jobs/126136729127/rerun with HTTP 403, “Must have admin rights to Repository.” A collaborator/admin retry and further runner-side diagnosis remain required.

There is also fresh native Windows evidence at this exact head: Server 2025/GNU 15.2, 2,789 passed / 981 skipped / zero failed, 3,770 scheduled, 159.00 s. All 15 accept cases pass, including both descriptor-install failure injections and cancellation/jump handoff disposal before cleanup/TSD. The handoff-onward resource snapshot still cannot exclude earlier setup leaks. The corrected guest_socket_dontwait passes (5.87 s), alongside guest_udp (1.73 s) and guest_socket_transfer_progress (2.66 s). This now executes the repaired unsupported-throw assertion natively; the older failed assertion report is superseded.

@JJenkx One guest_io_context_sigjump sample passes in 0.02 s on this Server 2025 runner. That does not resolve or qualify the intermittent Windows 22621 hang. Accept remains draft; review remains COMMENTED, not approval. Full PR template refreshed with exact heads, checks and limits. No new source push; unpublished runtime candidates remain excluded pending their own verification.

@Felipebmaitan

Copy link
Copy Markdown
Contributor Author

Audited the overlap refresh updated 2026-11-03 19:43:14 UTC, at unchanged accept 27a82bc: 20 compared / 90 uncomparable branches.

Re-read all 20 compared live heads. The previously compared pins are unchanged except #15135 b83067a. Its new commit changes received stream sockets from unconditionally connected to checking the host peer via getpeername, with matching tests/debt. Later composition must preserve that distinction, accepted/socketpair state, SCM_RIGHTS ownership and this stack's cancellation/Native boundaries. No import or joint runtime result is claimed.

New compared #15567 f5dacc4 adds checked pthread-name copies, failure-before-mutation and unchanged-name/error-order tests, and debt for its unmeasured Sony name limit/precedence. It supplies no helper accept requires. Preserve its independent coverage/debt alongside I/O cancellation when composed.

#7192 remains open at unchanged 396137d, now uncomparable against main's handler changes. Newly uncomparable #7645 63298da changes shared test runtime-DLL staging and no-staging opt-outs/output directories; read those shared CMake patches. Later composition must retain deliberate loader-test isolation and existing I/O test paths/registrations. Neither is cleared as a whole branch or a new implementation dependency. All 90 uncomparable branches remain uncleared; archive #11625 stays untouched.

Fetched current main 086c068. Read-only merge-tree composition with this accept head is clean and retains its adopted-stack bounds refresh and committed-read fault recovery alongside I/O retirement; no build/runtime qualification of the newer main is inferred. Udp.cpp is unchanged from CI's main baseline. The existing-main sendto notice does not establish duplicate registration: main, accept and the composed tree each have one sendto definition and canonical declaration; _sendto forwards to it, while this stack wraps the existing export in cancellation/descriptor admission.

Full-template audit updated. Depends on remains #12149, #12682, #12688, #9019, #12700; no new order agreement, source push or base change. Exact-head CI limits remain as recorded: Windows passes, macOS x86-64 timeout needs an admin retry/further diagnosis, Windows 22621 sigjump remains unresolved. Accept remains draft and review COMMENTED.

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 5, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants